<?php


  function https($force_https = false)
  {
  	if ($force_https && !$_SERVER['HTTPS']) {
  		location("https://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}");
  	}
  	
  	return !empty($_SERVER['HTTPS']);
  }